<template>
  <view class="page-wrapper">
    <!--
    {
      "path": "test/treetest",
      "style": {
        "navigationBarTitleText": "数据字典树形弹窗"
      }
    }
    -->
    <nav-bar :title="info.pageTitle">
      <template #right>
        <view class="navbar-right-box">
          <text
            class="top-btn btn-fault"
            v-show="info.showBtnDelete"
            @click="deleteBtnHandler"
          >删除</text>
        </view>
      </template>
    </nav-bar>

    <view class="page-main">
      <scroll-view>
        <view class="page-container">
          <uni-list>
            <uni-list-item
              class="required"
              showArrow
              title="类别"
              :rightText="info.rightText.orderType"
              clickable
              @click="openPopup_orderType"
            />
          </uni-list>
        </view>
      </scroll-view>
    </view>

    <PopupTreeList
      ref="ReforderType"
      title="类别"
      :categoryType="'order_type_dict'"
      :singleSelect="false"
      :defaultSelected="'ZZ06'"
      :submitKey="'orderType'"
      @select="dictSelectHandler"
    />

  </view>
</template>

<script setup>
const ReforderType = ref(null);

// 页面数据
let info = reactive({
  pageTitle: '树形测试',
  formData: {
    orderType: '', // 类别
  },
  // 选择项右侧显示的文字
  rightText: {
    orderType: '', // 类别
  },
  // 选择项的Option
  selectOption: {
    orderType: [], // 类别
  },
});


// 选择项的打开事件
const dictSelectHandler = (item, submitKey) => {
  console.log('选择的选项', submitKey, item.name, item.value);
  // info.rightText[submitKey] = item.name || item.showname;
  // info.formData[submitKey] = item.value;
};

// 类别
const openPopup_orderType = () => {
  ReforderType.value.open('bottom');
};

onMounted(() => {
});
</script>

<style lang="scss" scoped>
.page-wrapper {
  background-color: #f5f5f5;
}
</style>
